package edu.zzti.fruit;

import java.util.Scanner;

public class test {

    public static float average(Fruit f1,Fruit f2)
    {
        float c;
        c=(f1.getWeight()+f2.getWeight())/2;
        return c;
    }

    public static void main(String[] args) {
        Fruit f1 = new Fruit();
        Fruit f2 = new Fruit();
        System.out.print("请输入水果f1的质量和颜色：");
        Scanner input = new Scanner(System.in);
        float weight1 = input.nextFloat();
        String color1 = input.next();
        f1.setWeight(weight1);
        f1.setColor(color1);

        System.out.print("请输入水果f2的质量和颜色：");
        float weight2=input.nextFloat();
        String color2=input.next();
        f2.setWeight(weight2);
        f2.setColor(color2);

        float avr=average(f1,f2);
        System.out.println("水果f1的质量:"+f1.getWeight()+"     水果f1的颜色:"+f1.getColor());
        System.out.println("水果f2的质量:"+f2.getWeight()+"     水果f2的颜色:"+f2.getColor());
        System.out.println("水果f1和f2的质量平均值:"+avr);
        input.close();

    }

}
